<?php
namespace app\providers\middleware;
use think\facade\View;
use app\admin\service\ShieldIp as ShieldIpService;

/**
* ip校验中间件
* @package app\http\middleware
*/
class ChenkIp 
{	
	//自执行中间件方法
   	public function handle($request, \Closure $next){
   	    
        //ip变更，需要重新登录
        if( $request->userInfo && $request->userInfo['land_ip'] != $request->ip() ){
            if( $request->isAjax() ){
                // return \Api::ReError('请重新登录！',-10);
            }
            // die( View::fetch("layout/default") ); 
        }
        
        return $next($request);
    }
    

}